import request, {
  Method,
  buyerUrl,
  commonUrl,
  managerUrl,
  sellerUrl,
  expertUrl
} from '@/plugins/request.js';

//获取专家列表

export function getExperts(params) {
  return request({
    url: expertUrl + '/expert/expert/expert/PC/expertSortList',
    needToken: true,
    method: Method.POST,
    data: params,
    headers: {
      'Content-Type': 'application/json',
    },
  });
}
//获取专家知识

export function getKnowledge(params) {
  return request({
    url: expertUrl + '/expert/expert/expert/knowledge',
    needToken: true,
    method: Method.POST,
    data: params,
    headers: {
      'Content-Type': 'application/json',
    },
  });
}

//获取专家课程
export function getSubject(id) {
  return request({
    url: expertUrl + `/expert/expert/expert/getExpertCourse/${id}`,
    needToken: true,
    method: Method.GET,


  });
}
//根据id获取专家；
export function getExpertId(id) {
  return request({
    url: expertUrl + `/expert/expert/expert/${id}`,
    needToken: true,
    method: Method.get,

    headers: {
      'Content-Type': 'application/x-www-form-urlencoded',
    },
  });
}

//获取专家课程列表
export function getCouseList(data) {
  return request({
    url: expertUrl + `/expert/course/courseSeries/pagelist`,
    needToken: true,
    method: Method.POST,
    headers: {
      'Content-Type': 'application/json',
    },
    data
  });
}

//获取专家 知识列表
export function informationList(data) {
  return request({
    url: expertUrl + `/expert/information/information/pagelist`,
    needToken: true,
    method: Method.POST,
    headers: {
      'Content-Type': 'application/json',
    },
    data
  });
}

//专家点赞
export function setExpertDz(id) {
  return request({
    url: expertUrl + `/expert/expert/expert/liked/${id}`,
    needToken: true,
    method: Method.GET,
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded',
    }
  });
}

// 专家动态 列表
export function getExpertDynamic(data) {
  return request({
    url: buyerUrl + `/buyer/dynamic/expertDynamic/page`,
    needToken: true,
    data,
    method: Method.POST,
    headers: {
      'Content-Type': 'application/json',
    }
  });
}
// 专家动态点赞
export function setExpertDynamicLike(dynamicId) {
  return request({
    url: buyerUrl + `/buyer/dynamic/expertDynamic/like/${dynamicId}`,
    needToken: true,
    method: Method.GET,
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded',
    }
  });
}
//  专家动态收藏
export function setExpertDynamicCollect(dynamicId) {
  return request({
    url: buyerUrl + `/buyer/dynamic/expertDynamic/collect/${dynamicId}`,
    needToken: true,
    method: Method.GET,
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded',
    }
  });
}

//  根据id获取动态详情
export function getExpertDynamicInfo(dynamicId) {
  return request({
    url: buyerUrl + `/buyer/dynamic/expertDynamic/${dynamicId}`,
    needToken: true,
    method: Method.GET,
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded',
    }
  });
}


// 专家动态 根据动态id获取一级评论
export function getExpertDynamicCommentById(data) {
  return request({
    url: buyerUrl + `/buyer/dynamic/expertDynamicComment/oneLevel`,
    needToken: true,
    data,
    method: Method.POST,
    headers: {
      'Content-Type': 'application/json',
    }
  });
}
//  专家动态  新增评论 或回复
export function addExpertDynamicComment(data) {
  return request({
    url: buyerUrl + `/buyer/dynamic/expertDynamicComment/save`,
    needToken: true,
    data,
    method: Method.POST,
    headers: {
      'Content-Type': 'application/json',
    }
  });
}
// 专家动态回复点赞
export function setExpertDynamicCommentLike(dynamicCommentId) {
  return request({
    url: buyerUrl + `/buyer/dynamic/expertDynamicComment/like/${dynamicCommentId}`,
    needToken: true,
    method: Method.GET,
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded',
    }
  });
}

